package org.seedltd.upms.model.sys.form;

import lombok.Getter;
import lombok.Setter;
import org.hibernate.validator.constraints.Length;
import org.seedltd.core.validation.Save;
import org.seedltd.core.validation.Update;
import org.seedltd.upms.enums.UserEnableStatus;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.util.List;

/**
 * 系统用户
 *
 * @author laizuan
 * @date 2019/10/22
 */
@Getter
@Setter
public class SysUserForm {
    /**
     * 用户主键
     */
    @NotNull(message = "修改数据主键不能为空", groups = {Update.class})
    private Long userId;

    /**
     * 登入账户
     */
    @Length(max = 40, min = 4, message = "登入账号长度介于4到40个字符之间", groups = {Save.class})
    @NotBlank(message = "登入账号不能为空", groups = {Save.class})
    private String loginName;

    /**
     * 登入密码
     */
    private String password;

    /**
     * 公司主键
     */
    private Long companyId;

    /**
     * 用户名称
     */
    @Length(max = 20, message = "用户名称长度不能超过20个字符", groups = {Save.class})
    @NotBlank(message = "用户名称不能为空", groups = {Save.class})
    private String nickName;

    /**
     * 手机号
     */
    @Pattern(regexp = "^1(3|4|5|6|7|8|9)\\d{9}$", message = "手机号码不合法", groups = {Save.class})
    private String mobile;

    /**
     * 邮箱
     */
    @Pattern(regexp = "^([A-Za-z0-9_+-.])+@([A-Za-z0-9\\-.])+\\.([A-Za-z]{2,22})$", message = "邮箱格式不合法", groups = {Save.class})
    private String email;

    /**
     * 启用状态(1启用 0禁用 2注销)
     */
    @NotNull(message = "启禁用标识不能为空", groups = {Save.class})
    private UserEnableStatus enabled;

    /**
     * 备注
     */
    @Length(max = 100, message = "备注长度不能超过100个字符", groups = {Save.class})
    private String remark;

    /**
     * 部门集合
     */
    @NotEmpty(message = "请选择所在部门", groups = {Save.class})
    private List<Long> deptIdList;

    /**
     * 部门集合
     */
    @NotEmpty(message = "请选择所在部门", groups = {Save.class})
    private List<Long> roleIdList;

     /**
     * 岗位集合
     */
    private List<Long> postIdList;


}